package com.njwb.day05;

public class User {
    String username;
    String password;
    String address;

    public  User(){}

    public User(String username,String password,String address){
        //将传入的参数赋值给成员属性
        //变量操作时遵循就近原则
        //当方法中参数名与类中属性名一致时，根据就近原则没法对属性进行直接赋值
        //区分属性和变量：this->当前类自己本身
        this.username=username;
        this.password=password;
        this.address=address;
        /*System.out.println(username);
        System.out.println(password);
        System.out.println(address);
        System.out.println("上面三个是构造方法中的变量");*/
    }

    public void fn(String username){
        this.username=username;
        //this.fn2();
        fn2();

    }

    public void fn2(){
        System.out.println("User.fn2");
    }

    public void fn3(){
        //当前类自己本身
        //创建的对象实例是谁，this表示的就是谁
        System.out.println(this);
    }
}
